﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Xml.Serialization;
using DoubleH.Utility;
using System.Windows.Media;

namespace DoubleH.Configuration
{
    public class UserConfig
    {
        string ws = "000000";
        /// <summary>
        /// 报表查询起始时间
        /// </summary>
        public string WorkStart { get { return ws; } set { ws = value; } }

        string we = "235959";
        /// <summary>
        /// 报表查询结束时间
        /// </summary>
        public string WorkEnd { get { return we; } set { we = value; } }

        bool synchronousData = true;
        /// <summary>
        /// 同步刷新用户界面数据
        /// </summary>
        public bool SynchronousData
        {
            get { return synchronousData; }
            set { synchronousData = value; }
        }

        bool gd = true;
        /// <summary>
        /// 查询是否分组返回全部数据
        /// </summary>
        public bool GroupData { get { return gd; } set { gd = value; } }

        uint gdc = 50;
        /// <summary>
        /// 查询返回数据行数
        /// </summary>
        public uint GroupDataCount { get { return gdc; } set { gdc = value; } }

        bool alert = true;
        /// <summary>
        /// 开启系统预警
        /// </summary>
        public bool Alert { get { return alert; } set { alert = value; } }

        bool showAlert = true;
        /// <summary>
        /// 自动弹出预警窗体
        /// </summary>
        public bool ShowAlert { get { return showAlert; } set { showAlert = value; } }

        int alertTime = 10;
        /// <summary>
        /// 预警检测时间
        /// </summary>
        public int AlertTime
        {
            get { return alertTime; }
            set { alertTime = value; }
        }

       string br="Gray";
       public string BrushString
       {
           get { return br; }
           set { br = value; }
       }
        [XmlIgnore]
       public Brush Brush
       {
           get
           {
               BrushConverter bcc = new BrushConverter();
               if (bcc.CanConvertFrom(typeof(string)))
                   return (Brush)bcc.ConvertFromString(br);
               else
                   return Brushes.Gray;
           }
           set
           {

               BrushConverter bcc = new BrushConverter();
               if (bcc.CanConvertTo(typeof(string)))
                   bcc.ConvertToString(value);
           }
       }

        private List<ListViewBinding> m_aceColumns = new List<ListViewBinding>();
        /// <summary>
        /// 获取或设置可显示的列与列的排序
        /// </summary>
        [XmlArray("ListViewBinding")]
        public List<ListViewBinding> ListViewBinding
        {
            get { return m_aceColumns; }
            set
            {
                if (value == null)
                    throw new ArgumentNullException("value");

                m_aceColumns = value;
            }
        }
    }
}